import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class TopRoute extends PageRouteBuilder {
  final Widget page;

  TopRoute(this.page)
      : super(
          transitionDuration: const Duration(milliseconds: 250),
          pageBuilder: (BuildContext context, Animation<double> animation1, Animation<double> animation2) {
            return page;
          },
    transitionsBuilder:(BuildContext context, Animation<double> animation1, Animation<double> animation2, Widget child){
            return SlideTransition(
              position: Tween<Offset>(
                begin: Offset(0.0, -1.0),
                end: Offset(0.0, 0.0)
              ).animate(CurvedAnimation(parent: animation1, curve: Curves.fastOutSlowIn)),
              child: Material(
                elevation: 4,
                  child: child),
            );
    }
        );
}
